#include<stdio.h>
#include<sys/socket.h>
#include<stdlib.h>
#include<unistd.h>
#include<string.h>
#include<arpa/inet.h>
#include<netinet/in.h>

int main()
{
    int sockfd=0;
    sockfd=socket(AF_INET,SOCK_STREAM,0);
    if(sockfd<0)
    {
        perror("socket");
        exit(-1);

    }

    int err_log=0;
    unsigned short port=8000;
    char *server_ip="127.0.0.1";
    struct sockaddr_in server_addr;
    bzero(&server_addr,sizeof(server_addr));
    server_addr.sin_family=AF_INET;
    server_addr.sin_port=htons(port);
    inet_pton(AF_INET,server_ip,&server_addr.sin_addr);
    err_log=connect(sockfd,(struct sockaddr*)&server_addr,sizeof(server_addr));
    if(err_log!=0)
{
	perror("connect");
	close(sockfd);
	exit(-1);
}
 return 0;
}
